﻿@page "/OutBoundAging2"
@inject ModalService _modalService
@inject MessageService _message
@inject AG2WareHouseServer _ag2WareHouseServer
<h3>AGING2出库</h3>
<Row>
    <Row>
        <Col Span="24">请输入库位编号</Col>
    </Row>
    <br />
    <Col Span="24">
    <Input style="width:100%" Placeholder="Basic usage" @bind-Value="@Remark" />
    </Col>
</Row>
<br>
<br>
<Row>
    <Col Span="24">
    <Button style="width:100%" Type="@ButtonType.Primary" @onclick="@Creat">出库</Button>
    </Col>
</Row>

@code {
    private string Remark;
    private async Task Creat()
    {
        _modalService.Confirm(new ConfirmOptions()
            {
                Title = "提示",
                Icon =@<Icon Type="exclamation-circle" Theme="Outline"></Icon>,
            Content = "是否提交？",
            OkText = "确认",
            OnOk = async (e) =>
            {
                if (String.IsNullOrEmpty(Remark))
                {
                    await _message.Info("请输入库位编号");
                    return;
                }
                else
                {
                    string remark = Remark.Trim();
                    //var aG2Warehouse = await _ag2WareHouseServer.GetAG2Warehouse_Entity(remark);
                    //if (aG2Warehouse == null)
                    //{
                    //    await _message.Info("未找到此编号的库位信息");
                    //    return;
                    //}
                    //if (aG2Warehouse.IsCreat) 
                    //{
                    //    await _message.Info("该库位存在任务");
                    //    return;
                    //}
                    //if (!aG2Warehouse.ISHave)
                    //{
                    //    await _message.Info("该库位为空");
                    //    return;
                    //}
                    var result = await _ag2WareHouseServer.CreatOutBoundTask(remark);
                    await _message.Info(result);
                }

            },
            CancelText = "取消"
        });


    }
}
